<div class="form">
  <div class="header"> Suggest me something: </div>
  
  <% form_remote_tag(
      :url => { 
        :controller => "ratings",
        :action     => "new" },
      :bind => "this",
      :failure =>
        "Submit.updateErrors('Sorry, something went wrong.');",
      :success =>
        "Ratings.resetForm(this, true);",
      :complete => 
        "Submit.genericAfterSubmit(this);",
      :before => "if (!Submit.genericSubmit(this)) return false; if (!Ratings.validate(this)) { Submit.genericAfterSubmit(this); return false;}",
      :html => {
        :class => "default_enable" }
      ) do %>
    <%= hidden_field_tag "display_type_after_submit", @type.nil? ? 1 : 0, :id => nil %>
    <%= hidden_field_tag "guid", "", :id => nil, :class => "guid" %>
      
    <%= select(
          "rateable_object", 
          "type", 
          RateableObject::TYPES.collect { |t| [t.capitalize, t] }, 
          { :selected => @type }, 
          { :class => "default rateable_type", 
            :name => "type",
            :onchange => "Ratings.changeType(this); return false;"} ) %>
    
    <%= text_field_tag(
          "name", 
          "Title", 
          :id => nil,
          :class => "default dormant rateable_name",
          :disabled => "disabled",
          :autocomplete => "off",
          :dormant_value  => "Title",
          :maxlength => "50") %>
    <%= text_field_tag(
          "creator", 
          "Creator",
          :id => nil,
          :class => "default dormant rateable_creator ",
          :disabled => "disabled",
          :autocomplete => "off",
          :dormant_value  => "Creator",
          :maxlength => "50" ) %>
    <%= text_field_tag(
          "url", 
          "Link (Optional)", 
          :id => nil,
          :class => "default dormant rateable_url",
          :disabled => "disabled",
          :autocomplete => "off",
          :dormant_value  => "Link (Optional)",
          :maxlength => "50" ) %>
    <%= select(
          "rateable_object", 
          "rating", 
          ['Rating'] + (1..10).to_a.reverse, 
          {}, 
          { :id => nil,
            :class => "default rateable_rating", 
            :name => "rateable_rating" } ) %>
          
    <%= submit_tag "+", :class => "default submit" %>  
    
    <div class="loading" style="display: none;"><%= image_tag("loading.gif", :style => "padding: 2px 0px;") %></div>
    
    <br class="clear"/>
    <div class="errors">
    </div>
  <% end %>
  
  <%= javascript_tag( %Q(
      Event.observe(window, "load", function() {
        Ratings.changeType($('rateable_object_type'));
      });) ) %>

</div>
